package com.handinglian.ai.notice.service.impl;

import cn.hutool.core.date.DateUtil;
import com.github.pagehelper.PageHelper;
import com.handinglian.ai.common.dto.CommonPage;
import com.handinglian.ai.common.util.FastJsonUtil;
import com.handinglian.ai.notice.dto.KeyGroupDetailDto;
import com.handinglian.ai.notice.dto.NoticeDto;
import com.handinglian.ai.notice.entity.KeyGroupDetail;
import com.handinglian.ai.notice.entity.Notice;
import com.handinglian.ai.notice.enums.ExecuteStateEnum;
import com.handinglian.ai.notice.mapper.KeyGroupDetailMapper;
import com.handinglian.ai.notice.mapper.NoticeMapper;
import com.handinglian.ai.notice.param.KeyGroupDetailCreateParam;
import com.handinglian.ai.notice.param.KeyGroupDetailUpdateParam;
import com.handinglian.ai.notice.param.NoticeCreateParam;
import com.handinglian.ai.notice.param.NoticeUpdateParam;
import com.handinglian.ai.notice.service.KeyGroupDetailService;
import com.handinglian.ai.notice.service.MassService;
import com.handinglian.ai.notice.service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

@Service
public class KeyGroupDetailServiceImpl implements KeyGroupDetailService {
    @Autowired
    private KeyGroupDetailMapper keyGroupDetailMapper;

    @Override
    @Transactional
    public int createBatch(List<KeyGroupDetail> details) {
        return keyGroupDetailMapper.batchInsert(details);
    }

    @Override
    public List<KeyGroupDetail> list(Integer keyGroupId) {
        return keyGroupDetailMapper.findByKeyGroupId(keyGroupId);
    }

    @Override
    @Transactional
    public int delete(Integer keyGroupId) {
        return keyGroupDetailMapper.deleteByKeyGroupId(keyGroupId);
    }

    @Override
    @Transactional
    public int updateBatch(List<KeyGroupDetail> details) {
        return keyGroupDetailMapper.updateBatch(details);
    }

    @Override
    @Transactional
    public int delete(List<Integer> ids) {
        return keyGroupDetailMapper.deleteByIdIn(ids);
    }

    @Override
    public List<KeyGroupDetail> listByNoticeId(Integer noticeId) {
        return keyGroupDetailMapper.findByNoticeId(noticeId);
    }
}
